The present invention relates to a method for program writing and more particularly to a method for writing programs in application system.
Computer systems can be categorized into reprogrammable system and embedded ones according to their characteristic. The reprogrammable system is similarly to the personal computer comprising storage devices for storing a lot of data, a keyboard for inputting information and a display for showing the result. The programs can be stored in the storage devices, then users can use the keyboard to input special command to call the program to process and the processing result will be showed in the display. The programmers can correct or rewrite the programs if needed.
Embedded system is the so-called single chip micro-processor. In this kind of embedded system, the program memory and input/output devices are embedded into one chip. The program code is then written into the program memory by a writer so as to carry out special process, such as micro-controlling a machine, etc. The single chip micro-processor may be therefore called microntroller or embedded micro-controller unit, i.e. embedded MCU. Utilizing the embedded system in a microcomputer system may simplify design and reduce the manufacture cost due to the elimination of considering the design of the interface between the memory and input/output units.
FIG. 1 shows a block diagram of micro-controller 100 comprising a micro processor 102, a program memory 104 and a plurality of function blocks 106. The input/output, processing and calculation of data are sequentially executed according to instruction in the program by micro processor 102. In the programming process, after receiving the input information, the micro processor 102 may call application programs and read data stored in program memory 104 through a buffer, and then processes and calculates the data according to the instructions in the application program. The micro processor will send the processed result to the output devices or utilize it to drive a plurality of function blocks 106.
FIG. 2 shows a block diagram of embedded micro-controller application system 200, which comprises input device 202, embedded micro-controller unit 100 and a plurality of function blocks. The input device, after receiving the input information, may transfer a required signal and input information to the embedded micro-controller unit 100. The embedded micro-controller unit 100, after receiving the signal and information, may process the received information and then transfer the calculating result to function block 204 for the subsequent processing.
The program code, e.g. important application programs and basic input/output operating system, i.e. BIOS, stored in the program memory 104 must not bedeleted when the power applied to the program memory 104 is removed. However, the program code often needs to be corrected often during the stages of software development or renewing the software function. The flash erasable and programmable read only memory, flash EPROM, is the popular program memory in the industry.
There are two methods to write program code into the flash EPROM. One is to take apart the embedded micro-controller unit from the system and then put it in the EPROM writer to write the program code into the flash EPROM. The embedded micro-controller unit needs to be taken apart from the system repeatedly when correcting the bugs, the machine therefore needs to be shut down during the renewing process, which may interrupt the manufacturing process. The other one is in-system programming. The embedded micro-controller unit does not need to be taken apart from the system during the writing process according to the method. The system may therefore maintain the basic function. However, the micro-processor""s reading the renewing data will cause the system to perform wrongly. The micro-processor may hence move to the other program memory to work for avoiding performing wrong job. The micro-processor will transfer those data to a program memory which needs to be renewed after receiving data. However, their exists some drawbacks in the method. The writing process will reduce operation speed of the micro-processor due to the micro-processor""s participatiom. On the other hand, the method requires additional program memory to provide the micro-processor operation during the writing process, which will increase the manufacture cost. Another in system programming method is setting the embedded micro-controller unit to reset state immediately while the micro-processor in the unit receives the request of renewing the program code. The output port and function block of the micro-processor may not work under this situation and thus the possibility for the whole system damage will increase.
It is therefore a main objective of the present invention to provide an improved method for writing program codes. The embedded micro-controller application system according to the present invention includes an embedded micro-controller unit having one two-pin serial interface. A program control device connects to the embedded micro-controller application system to write the program codes into a flash EPROM. The implementation of using a serial interface to write program codes is capable of reducing the time consuming because the program codes may be written into the program memory directly through the serial interface so as to eliminate the micro-processor participating step and improve the writing speed.
Another objective of the invention is to provide one two-pin serial interface for directly writing program code into the program memory. The control method is therefore easy due to the two pins writing process.
In accordance with the above objectives of the present invention, a new method is provided in the embedded micro-controller application system for directly writing program code into the flash EPROM.